﻿<%@ Page Title="" Language="C#" MasterPageFile="~/ProjectMaster.master" AutoEventWireup="true"
    CodeBehind="createDuan.aspx.cs" Inherits="Giaiphongmatbang.createDuan" %>

<%@ Register assembly="AjaxControlToolkit" namespace="AjaxControlToolkit" tagprefix="asp" %>

<asp:Content ID="Content1" ContentPlaceHolderID="head" runat="server">
    <script type="text/javascript">
        function addField() {
            var element = "<div class='nl' style='width:340px; margin-left:16px;'>" + $('.box .nl:first').html() + "</div>";   
            $('.box').append(element);
            return false;
        }

        function removeField() {
            var element = $('.box .nl:not(:first):last ');
            element.remove();
            return false;
        }
        function AppliesValue() {
            if ($.trim($('#<%=txtProjectName.ClientID %>').val()) == '') {
                alert('Chưa nhập tên dự án!');
                return false;
            }
            if ($.trim($('#<%=txtInvestor.ClientID %>').val()) == '') {
                alert('Chưa nhập ban quản lý dự án!');
                return false;
            }
            if (!confirm('Thêm mới dự án?')) return false;
            var value = '';
            $('#boxcontent div').each(function () {
                var fullName = $(this).find('input[name=txtFullName]').val();
                var Order = $(this).find('input[name=txtOrder]').val();
                var Representative = $(this).find('input[name=txtRepresentative]').val();
                value += fullName + '$--$' + Order + '$--$' + Representative + '|$--$|';
            });
            $('#<%=hdfValue.ClientID %>').val(value);
        }
    </script>
</asp:Content>
<asp:Content ID="Content2" ContentPlaceHolderID="ContentPlaceHolder1" runat="server">
    <fieldset class="box-content">
        <legend>thông tin dự án</legend>
        <p>
            <span>Tên dự án:</span>
            <asp:TextBox ID="txtProjectName" runat="server" CssClass="field"
                Width="450px" />
            <span class="required">(*)</span>
        </p>
        <p>
            <span>Ban quản lý dự án:</span>
            <asp:TextBox ID="txtInvestor" runat="server" CssClass="field" Width="450px" />
            <span class="required">(*)</span>
        </p>
        <p>
            <span>Ngày tạo dự án:</span>
            <span>
            <asp:TextBox ID="txtCreatedDate" runat="server" CssClass="field" />
            <asp:CalendarExtender ID="txtCreatedDate_CalendarExtender" runat="server" 
                Enabled="True" TargetControlID="txtCreatedDate">
            </asp:CalendarExtender></span>
        </p>
        <p>
            <span>Cho phép xem dự án</span>
            <asp:CheckBox ID="chkPublic" runat="server" />
        </p>
        <p>
            <span>Dự án đã hoàn thành</span>
            <asp:CheckBox ID="chkCompleted" runat="server" />
        </p>
        <div class="box-title">
            Danh sách ban quản lý dự án
            <div class="nr" style="padding-top:3px">
                <input type="image" src="Images/add-button.jpg" onclick="return addField();"  />
                &nbsp;
                <input type="image" src="Images/remove-button.png" onclick="return removeField();"/>                
            </div>
        </div>
        <div class="cl"></div>
        <asp:HiddenField ID="hdfValue" runat="server" />
        <div class="box clearfix" id="boxcontent">
            <div class="nl" style="width: 340px; margin-left:16px;">
                <p>
                    <span>Họ và tên:</span>
                    <input type="text" class="field" name="txtFullName" />
                </p>
                <p>
                    <span>Chức vụ:</span>
                    <input type="text" class="field" name="txtOrder" />
                </p>
                <p>
                    <span>Đại diện:</span>
                    <input type="text" class="field" name="txtRepresentative" />
                </p>   
                <hr style="margin-right:40px;" /> 
            </div>
        </div>
        <!--End .box-->
        <div class="box-title" style="text-align:center">
            <asp:Button ID="btnInsert" runat="server" Text="Đồng ý" OnClientClick="return AppliesValue();"
                OnClick="btnInsert_Click" CssClass="button"/>
            &nbsp;
            <asp:Button ID="btnCancel" runat="server" Text="Trở về" CssClass="button" 
                onclick="btnCancel_Click" />
        </div>
    </fieldset>
</asp:Content>
